<!--
  @author nowind
  @since 17/07/23 14:34
-->
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">

<head>
    <title>新增或编辑配件</title>
    <th:block th:replace="common/common :: jscss"/>
</head>
<body>
<div class="layui-fluid">

    <blockquote class="layui-crumb">
        <span>配件管理</span>&nbsp;&nbsp;>
        <a lay-href="/part/list.action">配件管理</a>&nbsp;&nbsp;>&nbsp;
        <span th:text="${(part.skuId == 0) ? '新增配件' : part.name}">新增或编辑配件</span>
    </blockquote>
    <form method="post" action="" class="layui-form" lay-filter="zmn-part-form">

        <div class="layui-card">


            <div class="layui-card-header" style="margin-top:10px;"><b>配件信息</b></div>
            <div class="layui-card-body">
                <div class="layui-form-item layui-hide">
                    <label class="layui-form-label layui-form-label-extend">配件ID</label>
                    <div class="layui-input-inline" style="width:400px">
                        <input type="text" name="skuId" th:value="${part.skuId}" placeholder="配件ID"
                               autocomplete="off" class="layui-input"/>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-label-extend layui-form-required">配件分类</label>
                    <div class="layui-input-inline">
                        <select name="categOneId" id="categOneId" lay-filter="categOneId" lay-verify="required" lay-search th:value="${part.categOneId}">
                            <option value="">请选择</option>
                            <option th:each="categ:${categOnes}"
                                    th:value="${categ.value}"
                                    th:selected="${categ.value == part.categOneId}"
                                    th:disabled="${!categ.status}"
                                    th:text="|${categ.text}${categ.status?'':'(已禁用)'}|">
                            </option>
                        </select>
                    </div>
                    <div class="layui-input-inline">
                        <select name="categId" id="categId" lay-filter="categId" lay-verify="required" lay-search th:value="${part.categId}">
                            <option value="">请选择</option>
                            <option th:each="categ:${categTwos}"
                                    th:value="${categ.value}"
                                    th:selected="${categ.value == part.categId}"
                                    th:disabled="${!categ.status}"
                                    th:text="|${categ.text}${categ.status?'':'(已禁用)'}|">
                            </option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required layui-form-label-extend ">配件名称</label>
                    <div class="layui-input-inline" style="width:400px">
                        <input type="text" name="name" th:value="${part.name}" placeholder="请输入配件名称"
                               lay-verify="required|selectNoZeroNoNull" autocomplete="off" class="layui-input" maxlength="50"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-label-extend ">厂商配件名称</label>
                    <div class="layui-input-inline" style="width:400px">
                        <input type="text" name="factoryName" th:value="${part.factoryName}" placeholder="请输入厂商配件名称"
                               autocomplete="off" class="layui-input" maxlength="50"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required layui-form-label-extend ">配件品牌</label>
                    <div class="layui-input-inline" style="width:400px">
                        <select name="brandId" id="brandId" lay-filter="brandId" lay-verify="required" lay-search th:value="${part.brandId}">
                            <option value="">请选择</option>
                            <option th:each="brandSimple:${brandSimpleList}"
                                    th:value="${brandSimple.value}"
                                    th:selected="${brandSimple.value == part.brandId}"
                                    th:disabled="${!brandSimple.status}"
                                    th:text="|${brandSimple.text}${brandSimple.status?'':'(已禁用)'}|">
                            </option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required layui-form-label-extend ">单位</label>
                    <div class="layui-input-inline" style="width:240px;">
                        <select name="unit" id="unit" lay-filter="unit" lay-verify="required" lay-search th:value="${part.unit}">
                            <option value="">请选择</option>
                            <option th:each="unit:${unitList}"
                                    th:value="${unit}"
                                    th:selected="${unit == part.unit}"
                                    th:text="${unit}">
                            </option>
                        </select>
                    </div>
                </div>
                <!-- <div class="layui-form-item">
                     <label class="layui-form-label">厂家配件名</label>
                     <div class="layui-input-inline" style="width:400px;">
                         <input type="text" name="factoryName" th:value="${part.factoryName}" placeholder="厂家配件名称"
                                lay-verify="" autocomplete="off" class="layui-input" maxlength="100"/>
                     </div>
                     <div class="layui-form-mid layui-word-aux">厂家配件名称</div>
                 </div>
     -->
                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-label-extend ">包装规格</label>
                    <div class="layui-input-inline" style="width:240px;">
                        <input type="text" name="packSpec" th:value="${part.packSpec}" placeholder="请输入包装规格信息"
                               lay-verify="" autocomplete="off" class="layui-input" maxlength="32"/>
                    </div>
                </div>
                <div class="layui-form-item" th:if="${#authPermit.checkPermit('/part/price/showHq.action')}">
                    <label class="layui-form-label layui-form-required layui-form-label-extend ">总公司采购单价</label>
                    <div class="layui-input-inline" style="width:240px;">
                        <input type="text" name="hqPurchasePriceStr" th:value="${part.hqPurchasePriceStr}" placeholder="请输入总公司采购单价"
                               lay-verify="required|amount" autocomplete="off" class="layui-input" maxlength="10"/>
                    </div>
                </div>
                <div class="layui-form-item" th:if="${#authPermit.checkPermit('/part/price/showSub.action')}">
                    <label class="layui-form-label layui-form-required layui-form-label-extend ">子公司采购单价</label>
                    <div class="layui-input-inline" style="width:240px;">
                        <input type="text" name="subPurchasePriceStr" th:value="${part.subPurchasePriceStr}" placeholder="请输入子公司采购单价"
                               lay-verify="required|amount" autocomplete="off" class="layui-input" maxlength="10"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-label-extend ">产品分类</label>
                    <div class="layui-input-inline" style="width:240px;">
                        <th:block th:switch="${part.productType}">
                            <input th:case="1" type="text" value="家电" disabled class="layui-input"/>
                            <input th:case="2" type="text" value="非家电" disabled class="layui-input"/>
                        </th:block>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-card">


            <div class="layui-card-header" style="margin-top:10px;"><b>配件图片</b></div>
            <div class="layui-card-body">
                <div class="layui-form-item">
                    <div id="img1"></div>
                    <div id="img2"></div>
                    <div id="img3"></div>
                    <div id="img4"></div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">状态</label>
                    <div class="layui-input-block">
                        <input type="radio" name="status"
                               th:each="status:${statuses}"
                               th:value="${status.key}"
                               th:checked="${status.key == part.status}"
                               th:title="${status.value}">
                    </div>
                </div>
            </div>
        </div>

        <div class="layui-card">
            <zmn th:if="${part.skuId > 0}">
                <div class="layui-card-header layui-margin-b"><b>其他信息</b></div>

                <div class="layui-form-item layui-form-item-sm">
                    <label class="layui-form-label" style="width: 120px;">修改人/时间：</label>
                    <div class="layui-input-block">
                        <div class="layui-form-mid layui-word-aux"
                             th:text="${part.updater} + '&nbsp;/&nbsp;' + ${#dates.format(part.updateTime, 'yyyy-MM-dd HH:mm:ss')}">
                            修改人/时间
                        </div>
                    </div>
                </div>
                <div class="layui-form-item layui-form-item-sm">
                    <label class="layui-form-label" style="width: 120px;">创建人/时间：</label>
                    <div class="layui-input-block">
                        <div class="layui-form-mid layui-word-aux"
                             th:text="${part.creater} + '&nbsp;/&nbsp;' + ${#dates.format(part.createTime, 'yyyy-MM-dd HH:mm:ss')}">
                            创建人/时间
                        </div>
                    </div>
                </div>
            </zmn>
        </div>


        <div class="layui-form-item layui-layout-admin">
            <div class="layui-input-block">
                <div class="layui-footer" style="left: 0;">
                    <button class="layui-btn" lay-submit="" lay-filter="zmn-part-form-submit" id="submit"
                            th:if="${#authPermit.checkPermit('/part/ajax/addEdit.action')}">保存</button>
                    <button class="layui-btn layui-btn-primary" type="button" id="cancel">取消</button>
                </div>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript" th:inline="javascript">

    let json = {
        part: [[${part}]],
    };

    layui.config({
        base: "/static/lay/",
        version: "201911181602"
    }).extend({
        index: "lib/index",
        plat_part: "{/}/static/js/module/part/zmn.plat.partSku.edit"
    }).use(['index', 'plat_part']);

</script>
</body>
</html>